﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SAPbobsCOM;
using System.Reflection;
using System.Runtime.Serialization;
namespace CompanySyncProject
{
    public class DIOpportunity : BaseRun
    {
        public DIOpportunity(Company co, System.IO.StreamWriter lo)
            : base(co, lo)
        {

        }

        public override void Run()
        {
            oCompany.XmlExportType = BoXmlExportTypes.xet_ExportImportMode;

            
            SAPbobsCOM.SalesOpportunities oppo = oCompany.GetBusinessObject(BoObjectTypes.oSalesOpportunities);
            oppo.OpportunityType = OpportunityTypeEnum.boOpSales;
            oppo.CardCode = "bkfhyjiulenpxvk";

            oppo.OpportunityName = "di oppo 1";
            oppo.StartDate = DateTime.Now;

            oppo.PredictedClosingDate = DateTime.Now.AddMonths(2);
            oppo.StatusRemarks = "what is the status";
            oppo.TotalAmountLocal = 100;

            oppo.Lines.PercentageRate = 25;
            oppo.Lines.StageKey = 1;
            oppo.Lines.MaxLocalTotal = 100;
            oppo.Lines.Add();

            oppo.Lines.PercentageRate = 30;
            oppo.Lines.StageKey = 2;
            oppo.Lines.MaxLocalTotal = 120;
            oppo.Lines.Add();

            oppo.Status = BoSoOsStatus.sos_Sold;

            oppo.Add();
            

            /*
            SAPbobsCOM.SalesOpportunities oppo = oCompany.GetBusinessObject(BoObjectTypes.oSalesOpportunities);
            oppo.GetByKey(1);
            oppo.SaveXML(@"..\..\test\oppo2.txt");
            */

        }
    }
}
